home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 100 / CD-ROM 100.iso / aplic / oo1_1 / f_0370 / sofftodocbookheadings.xsl
Encoding:
Extensible Markup Language  |  2003-06-04  |  28.4 KB  |  864 lines

  1. <?xml version='1.0' encoding="UTF-8"?>
  2. <!-- #  The Contents of this file are made available subject to the terms of
  3.  #  either of the following licenses
  4.  #
  5.  #         - GNU Lesser General Public License Version 2.1
  6.  #         - Sun Industry Standards Source License Version 1.1
  7.  #
  8.  #  Sun Microsystems Inc., October, 2000
  9.  #
  10.  #  GNU Lesser General Public License Version 2.1
  11.  #  =============================================
  12.  #  Copyright 2000 by Sun Microsystems, Inc.
  13.  #  901 San Antonio Road, Palo Alto, CA 94303, USA
  14.  #
  15.  #  This library is free software; you can redistribute it and/or
  16.  #  modify it under the terms of the GNU Lesser General Public
  17.  #  License version 2.1, as published by the Free Software Foundation.
  18.  #
  19.  #  This library is distributed in the hope that it will be useful,
  20.  #  but WITHOUT ANY WARRANTY; without even the implied warranty of
  21.  #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  22.  #  Lesser General Public License for more details.
  23.  #
  24.  #  You should have received a copy of the GNU Lesser General Public
  25.  #  License along with this library; if not, write to the Free Software
  26.  #  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  27.  #  MA  02111-1307  USA
  28.  #
  29.  #
  30.  #  Sun Industry Standards Source License Version 1.1
  31.  #  =================================================
  32.  #  The contents of this file are subject to the Sun Industry Standards
  33.  #  Source License Version 1.1 (the "License"); You may not use this file
  34.  #  except in compliance with the License. You may obtain a copy of the
  35.  #  License at http://www.openoffice.org/license.html.
  36.  #
  37.  #  Software provided under this License is provided on an "AS IS" basis,
  38.  #  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
  39.  #  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
  40.  #  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
  41.  #  See the License for the specific provisions governing your rights and
  42.  #  obligations concerning the Software.
  43.  #
  44.  #  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
  45.  #
  46.  #  Copyright: 2000 by Sun Microsystems, Inc.
  47.  #
  48.  #  All Rights Reserved.
  49.  #
  50.  #  Contributor(s): _______________________________________
  51.  #
  52.  #-->
  53. <xsl:stylesheet version="1.0" xmlns:style="http://openoffice.org/2000/style" xmlns:text="http://openoffice.org/2000/text" xmlns:office="http://openoffice.org/2000/office" xmlns:table="http://openoffice.org/2000/table" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="http://openoffice.org/2000/meta" xmlns:number="http://openoffice.org/2000/datastyle" xmlns:svg="http://www.w3.org/2000/svg" xmlns:chart="http://openoffice.org/2000/chart" xmlns:dr3d="http://openoffice.org/2000/dr3d" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="http://openoffice.org/2000/form" xmlns:script="http://openoffice.org/2000/script" xmlns:config="http://openoffice.org/2001/config" office:class="text" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="office meta  table number dc fo xlink chart math script xsl draw svg dr3d form config text style">
  54. <xsl:output method="xml" indent="yes" omit-xml-declaration="no"  />
  55. <xsl:output method="xml" version="1.0" encoding="UTF-8" doctype-public="-//OASIS//DTD DocBook XML V4.1.2//EN" doctype-system="http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" />
  56.  
  57.  
  58.  
  59. <xsl:key name='headchildren' match="text:p |table:table | text:span | text:ordered-list | office:annotation | text:unordered-list | text:footnote | text:a | text:list-item | draw:plugin | draw:text-box | text:footnote-body | text:section"
  60.    use="generate-id((..|preceding-sibling::text:h[@text:level='1']|preceding-sibling::text:h[@text:level='2']|preceding-sibling::text:h[@text:level='3']|preceding-sibling::text:h[@text:level='4']|preceding-sibling::text:h[@text:level='5'])[last()])"/>
  61.  
  62. <xsl:key name="children" match="text:h[@text:level='2']"
  63.    use="generate-id(preceding-sibling::text:h[@text:level='1'][1])"/>
  64.  
  65. <xsl:key name="children" match="text:h[@text:level='3']"
  66.    use="generate-id(preceding-sibling::text:h[@text:level='2' or @text:level='1'][1])"/>
  67.  
  68. <xsl:key name="children" match="text:h[@text:level='4']"
  69.    use="generate-id(preceding-sibling::text:h[@text:level='3' or @text:level='2' or @text:level='1'][1])"/>
  70.  
  71. <xsl:key name="children" match="text:h[@text:level='5']"
  72.    use="generate-id(preceding-sibling::text:h[@text:level='4' or @text:level='3' or @text:level='2' or @text:level='1'][1])"/>
  73.  
  74.  
  75. <xsl:template match="text:h[@text:level='1']">
  76. <xsl:choose>
  77.     <xsl:when test=".='Abstract'">
  78.         <abstract>
  79.             <xsl:apply-templates select="key('headchildren', generate-id())"/>
  80.                  <xsl:apply-templates select="key('children', generate-id())"/>
  81.         </abstract>
  82.     </xsl:when>
  83.     <xsl:otherwise>
  84.         <xsl:call-template name="make-section">
  85.             <xsl:with-param name="current" select="@text:level"/>
  86.                 <xsl:with-param name="prev" select="1"/>
  87.         </xsl:call-template>
  88.         <!--<sect1>
  89.                  <title>
  90.                        <xsl:apply-templates/>
  91.                  </title>
  92.                      <xsl:apply-templates select="key('headchildren', generate-id())"/>
  93.                  <xsl:apply-templates select="key('children', generate-id())"/>
  94.            </sect1>-->
  95.     </xsl:otherwise>
  96. </xsl:choose>
  97.    
  98. </xsl:template>
  99.  
  100. <xsl:template match="text:h[@text:level='2'] | text:h[@text:level='3']| text:h[@text:level='4'] | text:h[@text:level='5']">
  101. <xsl:variable name="level" select="@text:level"></xsl:variable>
  102. <xsl:call-template name="make-section">
  103.     <xsl:with-param name="current" select="$level"/>
  104.     <xsl:with-param name="prev" select="preceding-sibling::text:h[@text:level < $level][1]/@text:level "/>
  105. </xsl:call-template>
  106.  
  107. </xsl:template>
  108.  
  109. <xsl:template name="make-section">
  110.     <xsl:param name="current"/>
  111.     <xsl:param name="prev"/>
  112.     <xsl:choose>
  113.         <xsl:when test="$current > $prev+1">
  114.             <xsl:text disable-output-escaping="yes"><sect</xsl:text><xsl:value-of select="$prev +1"/><xsl:text disable-output-escaping="yes">></xsl:text>
  115.             <title>
  116.                 </title>
  117.             <xsl:call-template name="make-section">
  118.                 <xsl:with-param name="current" select="$current"/>
  119.                 <xsl:with-param name="prev" select="$prev +1"/>
  120.             </xsl:call-template>
  121.         <xsl:text disable-output-escaping="yes"></sect</xsl:text><xsl:value-of select="$prev +1 "/><xsl:text disable-output-escaping="yes">></xsl:text>
  122.         </xsl:when>
  123.         
  124.         <xsl:otherwise>
  125.             <xsl:text disable-output-escaping="yes"><sect</xsl:text><xsl:value-of select="$current"/><xsl:text disable-output-escaping="yes">></xsl:text>
  126.                     <title>
  127.                                <xsl:apply-templates/>
  128.                         </title>
  129.                  <xsl:apply-templates select="key('headchildren', generate-id())"/>
  130.                     <xsl:apply-templates select="key('children', generate-id())"/>
  131.             <xsl:text disable-output-escaping="yes"></sect</xsl:text><xsl:value-of select="$current"/><xsl:text disable-output-escaping="yes">></xsl:text>
  132.         </xsl:otherwise>
  133.     </xsl:choose>
  134. </xsl:template>
  135.  
  136.  
  137. <xsl:template match="text:p">
  138.         <xsl:element name="para">
  139.               <xsl:apply-templates/>
  140.         </xsl:element>
  141. </xsl:template>
  142.  
  143.  
  144.  
  145. <xsl:template match="/office:document">
  146.     <xsl:element name="article">
  147.         <xsl:attribute name="lang"><xsl:value-of select="/office:document/office:meta/dc:language"/>
  148.         </xsl:attribute>
  149.         <xsl:apply-templates />
  150.     </xsl:element>
  151. </xsl:template>
  152.  
  153. <xsl:template match="office:meta">
  154.     <!--<xsl:apply-templates/>-->
  155. </xsl:template>
  156.  
  157. <xsl:template match="text:ordered-list">
  158.     <xsl:element name="orderedlist">
  159.         <xsl:apply-templates/>
  160.     </xsl:element>
  161. </xsl:template>
  162.  
  163.  
  164.  
  165. <xsl:template match="meta:editing-cycles">
  166. </xsl:template>
  167.  
  168. <xsl:template match="meta:user-defined">
  169. </xsl:template>
  170.  
  171. <xsl:template match="meta:editing-duration">
  172. </xsl:template>
  173.  
  174. <xsl:template match="dc:language">
  175. </xsl:template>
  176.  
  177. <xsl:template match="dc:date">
  178.     <!--<pubdate>
  179.         <xsl:value-of select="substring-before(.,'T')"/>
  180.     </pubdate>-->
  181. </xsl:template>
  182.  
  183. <xsl:template match="meta:creation-date">
  184. </xsl:template>
  185.  
  186. <xsl:template match="office:body">
  187. <xsl:apply-templates select="key('headchildren', generate-id())"/>
  188.    <xsl:apply-templates select="text:h[@text:level='1']"/>
  189.     <!--<xsl:apply-templates/>-->
  190. </xsl:template>
  191.  
  192. <xsl:template match="office:styles">
  193.     <xsl:apply-templates/>
  194. </xsl:template>
  195.  
  196. <xsl:template match="office:script">
  197. </xsl:template>
  198.  
  199.  
  200. <xsl:template match="office:settings">
  201. </xsl:template>
  202.  
  203. <xsl:template match="office:font-decls">
  204. </xsl:template>
  205.  
  206. <xsl:template match="text:section">
  207. <xsl:choose>
  208.     <xsl:when test="@text:name='ArticleInfo'">
  209.         <articleinfo>
  210.             <title><xsl:value-of select="text:p[@text:style-name='Document Title']"/></title>
  211.             <subtitle><xsl:value-of select="text:p[@text:style-name='Document SubTitle']"/></subtitle>
  212.             <edition><xsl:value-of select="text:p/text:variable-set[@text:name='articleinfo.edition']"/></edition>
  213.             <xsl:for-each select="text:p/text:variable-set[substring-after(@text:name,'articleinfo.releaseinfo')]">
  214.                 <releaseinfo>
  215.                     <xsl:value-of select="."/>
  216.                 </releaseinfo>
  217.             </xsl:for-each>
  218.             <xsl:call-template name="ArticleInfo"><xsl:with-param name="level" select="0"/></xsl:call-template>
  219.     
  220.         </articleinfo>
  221.     </xsl:when>
  222.     <xsl:when test="@text:name='Abstract'">
  223.         <abstract>
  224.             <xsl:apply-templates/>
  225.         </abstract>
  226.     </xsl:when>
  227.     <xsl:when test="@text:name='Appendix'">
  228.         <appendix>
  229.             <xsl:apply-templates/>
  230.         </appendix>
  231.     </xsl:when>
  232.     <xsl:otherwise>
  233.         <xsl:variable name="sectvar"><xsl:text>sect</xsl:text><xsl:value-of select="count(ancestor::text:section)+1"/></xsl:variable>    
  234.         <xsl:variable name="idvar"><xsl:text> id="</xsl:text><xsl:value-of select="@text:name"/><xsl:text>"</xsl:text></xsl:variable>
  235.         <xsl:text disable-output-escaping="yes"><</xsl:text><xsl:value-of select="$sectvar"/><xsl:value-of select="$idvar"/><xsl:text  disable-output-escaping="yes">></xsl:text>
  236.             <xsl:apply-templates/>
  237.         <xsl:text disable-output-escaping="yes"></</xsl:text><xsl:value-of select="$sectvar"/><xsl:text  disable-output-escaping="yes">></xsl:text>
  238.     </xsl:otherwise>
  239.  
  240.  
  241. </xsl:choose>
  242. </xsl:template>
  243.  
  244. <xsl:template name="ArticleInfo">
  245.     <xsl:param name="level"/>
  246.     <xsl:variable name="author"><xsl:value-of select="concat('articleinfo.author_','', $level)"/></xsl:variable>
  247.     <xsl:if test="text:p/text:variable-set[contains(@text:name, $author )]">
  248.         <xsl:call-template name="Author"><xsl:with-param name="AuthorLevel" select="0"/></xsl:call-template>
  249.         <xsl:call-template name="Copyright"><xsl:with-param name="CopyrightLevel" select="0"/></xsl:call-template>    
  250.     </xsl:if>    
  251. </xsl:template>
  252.  
  253. <xsl:template name="Copyright">
  254.     <xsl:param name="CopyrightLevel"/>
  255.     
  256.     <xsl:variable name="Copyright"><xsl:value-of select="concat('articleinfo.copyright_','', $CopyrightLevel)"/></xsl:variable>
  257.     
  258.     <xsl:if test="text:p/text:variable-set[contains(@text:name,$Copyright)]">
  259.         <copyright>
  260.             <xsl:call-template name="Year">
  261.                 <xsl:with-param name="CopyrightLevel" select="$CopyrightLevel"/>
  262.                 <xsl:with-param name="YearlLevel" select="0"/>
  263.             </xsl:call-template>
  264.             <xsl:call-template name="Holder">
  265.                 <xsl:with-param name="CopyrightLevel" select="$CopyrightLevel"/>
  266.                 <xsl:with-param name="HolderlLevel" select="0"/>
  267.  
  268.             </xsl:call-template>
  269.         </copyright>
  270.     </xsl:if>
  271. </xsl:template>
  272.  
  273.  
  274. <xsl:template name="Year">
  275.     <xsl:param name="CopyrightLevel"/>
  276.     <xsl:param name="YearLevel"/>
  277.     <xsl:variable name="Copyright"><xsl:value-of select="concat('articleinfo.copyright_','', $CopyrightLevel)"/></xsl:variable>
  278. <xsl:variable name="Year"><xsl:value-of select="concat($Copyright,'',concat('.year_','',$YearLevel))"/></xsl:variable>
  279.  
  280.     <xsl:if test="text:p/text:variable-set[@text:name=$Year]">
  281.         <orgname>
  282.             <xsl:value-of select="text:p/text:variable-set[@text:name=$Year]"/>
  283.         </orgname>
  284.     </xsl:if>
  285. </xsl:template>
  286.  
  287.  
  288. <xsl:template name="Holder">
  289.     <xsl:param name="CopyrightLevel"/>
  290.     <xsl:param name="HolderLevel"/>
  291.     <xsl:variable name="Copyright"><xsl:value-of select="concat('articleinfo.copyright_','', $CopyrightLevel)"/></xsl:variable>
  292. <xsl:variable name="Holder"><xsl:value-of select="concat($Copyright,'',concat('.holder_','',$HolderLevel))"/></xsl:variable>
  293.  
  294.     <xsl:if test="text:p/text:variable-set[@text:name=$Holder]">
  295.         <orgname>
  296.             <xsl:value-of select="text:p/text:variable-set[@text:name=$Holder]"/>
  297.         </orgname>
  298.     </xsl:if>
  299. </xsl:template>
  300.  
  301.  
  302.  
  303. <xsl:template name="Author">
  304.     <xsl:param name="AuthorLevel"/>
  305.     <xsl:variable name="Author"><xsl:value-of select="concat('articleinfo.author_','', $AuthorLevel)"/></xsl:variable>    
  306.     <xsl:if test="text:p/text:variable-set[contains(@text:name, $Author )]">
  307.         <author>
  308.             <xsl:call-template name="Surname"><xsl:with-param name="AuthorLevel" select="$AuthorLevel"/><xsl:with-param name="SurnameLevel" select="0"/></xsl:call-template>
  309.             <xsl:call-template name="Firstname"><xsl:with-param name="AuthorLevel" select="$AuthorLevel"/><xsl:with-param name="FirstnameLevel" select="0"/></xsl:call-template>
  310.             <xsl:call-template name="Affiliation"><xsl:with-param name="AuthorLevel" select="$AuthorLevel"/><xsl:with-param name="AffilLevel" select="0"/></xsl:call-template>
  311.         </author>
  312.         <xsl:call-template name="Author"><xsl:with-param name="AuthorLevel" select="$AuthorLevel+1"/></xsl:call-template>
  313.     </xsl:if>    
  314. </xsl:template>
  315.  
  316.  
  317. <xsl:template name="Surname">
  318.     <xsl:param name="AuthorLevel"/>
  319.     <xsl:param name="SurnameLevel"/>
  320.     <xsl:variable name="Author"><xsl:value-of select="concat('articleinfo.author_','', $AuthorLevel)"/></xsl:variable>
  321.     <xsl:variable name="Surname"><xsl:value-of select="concat($Author,'',concat('.surname_','',$SurnameLevel))"/></xsl:variable>
  322.     <xsl:if test="text:p/text:variable-set[@text:name=$Surname]">
  323.         <surname>
  324.             <xsl:value-of select="text:p/text:variable-set[@text:name=$Surname]"/>
  325.         </surname>
  326.         <xsl:call-template name="Surname"><xsl:with-param name="AuthorLevel" select="$AuthorLevel"/>
  327.         <xsl:with-param name="SurnameLevel" select="SurnameLevel+1"/>
  328.         </xsl:call-template>
  329.  
  330.     </xsl:if>
  331. </xsl:template>
  332.  
  333.  
  334.  
  335.  
  336. <xsl:template name="Firstname">
  337.     <xsl:param name="AuthorLevel"/>
  338.     <xsl:param name="FirstnameLevel"/>
  339.     <xsl:variable name="Author"><xsl:value-of select="concat('articleinfo.author_','', $AuthorLevel)"/></xsl:variable>
  340.     <xsl:variable name="Firstname"><xsl:value-of select="concat($Author,'',concat('.firstname_','',$FirstnameLevel))"/></xsl:variable>
  341.     <xsl:if test="text:p/text:variable-set[@text:name=$Firstname]">
  342.         <firstname>
  343.             <xsl:value-of select="text:p/text:variable-set[@text:name=$Firstname]"/>
  344.         </firstname>
  345.         <xsl:call-template name="Surname">
  346.             <xsl:with-param name="AuthorLevel" select="$AuthorLevel"/>
  347.             <xsl:with-param name="FirstnameLevel" select="FirstnameLevel+1"/>
  348.         </xsl:call-template>
  349.     </xsl:if>
  350. </xsl:template>
  351.  
  352.  
  353.  
  354. <xsl:template name="Affiliation">
  355.     <xsl:param name="AuthorLevel"/>
  356.     <xsl:param name="AffilLevel"/>
  357.     <xsl:variable name="Author"><xsl:value-of select="concat('articleinfo.author_','', $AuthorLevel)"/></xsl:variable>
  358.     <xsl:variable name="Affil"><xsl:value-of select="concat($Author,'',concat('.affiliation_','',$AffilLevel))"/></xsl:variable>
  359.     <xsl:if test="text:p/text:variable-set[contains(@text:name,$Affil)]">
  360.         <affiliation>
  361.             <xsl:call-template name="Orgname">
  362.                 <xsl:with-param name="AuthorLevel" select="$AuthorLevel"/>
  363.                 <xsl:with-param name="AffilLevel" select="$AffilLevel"/><xsl:with-param name="OrgLevel" select="0"/>
  364.             </xsl:call-template>
  365.             <xsl:call-template name="Address">
  366.                 <xsl:with-param name="AuthorLevel" select="$AuthorLevel"/>
  367.                 <xsl:with-param name="AffilLevel" select="$AffilLevel"/><xsl:with-param name="AddressLevel" select="0"/>
  368.  
  369.             </xsl:call-template>
  370.         </affiliation>
  371.     </xsl:if>
  372. </xsl:template>
  373.  
  374. <xsl:template name="Orgname">
  375.     <xsl:param name="AuthorLevel"/>
  376.     <xsl:param name="AffilLevel"/>
  377.     <xsl:param name="OrgLevel"/>
  378.  
  379.     <xsl:variable name="Author"><xsl:value-of select="concat('articleinfo.author_','', $AuthorLevel)"/></xsl:variable>
  380. <xsl:variable name="Affil"><xsl:value-of select="concat($Author,'',concat('.affiliation_','',$AffilLevel))"/></xsl:variable>
  381.     <xsl:variable name="Org"><xsl:value-of select="concat($Affil,'',concat('.orgname_','',$OrgLevel))"/></xsl:variable>
  382.  
  383.     <xsl:if test="text:p/text:variable-set[@text:name=$Org]">
  384.         <orgname>
  385.             <xsl:value-of select="text:p/text:variable-set[@text:name=$Org]"/>
  386.         </orgname>
  387.     </xsl:if>
  388. </xsl:template>
  389.  
  390. <xsl:template name="Address">
  391.     <xsl:param name="AuthorLevel"/>
  392.     <xsl:param name="AffilLevel"/>
  393.     <xsl:param name="AddressLevel"/>
  394.  
  395.     <xsl:variable name="Author"><xsl:value-of select="concat('articleinfo.author_','', $AuthorLevel)"/></xsl:variable>
  396. <xsl:variable name="Affil"><xsl:value-of select="concat($Author,'',concat('.affiliation_','',$AffilLevel))"/></xsl:variable>
  397.     <xsl:variable name="Address"><xsl:value-of select="concat($Affil,'',concat('.address_','',$AddressLevel))"/></xsl:variable>
  398.  
  399.     <xsl:if test="text:p/text:variable-set[@text:name=$Address]">
  400.         <address>
  401.             <xsl:value-of select="text:p/text:variable-set[@text:name=$Address]"/>
  402.         </address>
  403.     </xsl:if>
  404. </xsl:template>
  405.  
  406.  
  407.  
  408.  
  409. <xsl:template match="text:p[@text:style-name='Document Title']">
  410. </xsl:template>
  411.  
  412. <xsl:template match="text:p[@text:style-name='Document SubTitle']">
  413. </xsl:template>
  414.  
  415.  
  416. <xsl:template match="text:p[@text:style-name='Section Title']">
  417.     <xsl:element name="title">
  418.         <xsl:apply-templates/>
  419.     </xsl:element>
  420. </xsl:template>
  421.  
  422. <xsl:template match="text:p[@text:style-name='Appendix Title']">
  423.     <xsl:element name="title">
  424.         <xsl:apply-templates/>
  425.     </xsl:element>
  426. </xsl:template>
  427.  
  428.  
  429. <!--<xsl:template match="text:p[@text:style-name='VarList Item']">
  430.     <xsl:if test="not(preceding-sibling::text:p[@text:style-name='VarList Item'])">
  431.         <xsl:text disable-output-escaping="yes"><listitem></xsl:text>
  432.     </xsl:if>
  433.         <para>
  434.             <xsl:apply-templates/>
  435.         </para>
  436.     <xsl:if test="not(following-sibling::text:p[@text:style-name='VarList Item'])">
  437.         <xsl:text disable-output-escaping="yes"></listitem></xsl:text>
  438.     </xsl:if>
  439. </xsl:template>-->
  440.  
  441. <xsl:template match="text:p[@text:style-name='VarList Term']">
  442.     <xsl:element name="term">
  443.             <xsl:apply-templates/>
  444.     </xsl:element>
  445. </xsl:template>
  446.  
  447. <xsl:template match="text:p[@text:style-name='VarList Item']">
  448.     <xsl:element name="listitem">
  449.         <xsl:element name="para">
  450.             <xsl:apply-templates/>
  451.         </xsl:element>
  452.     </xsl:element>
  453. </xsl:template>
  454.  
  455. <xsl:template match="text:p[@text:style-name='Section1 Title']">
  456.     <xsl:element name="title">
  457.         <xsl:apply-templates/>
  458.     </xsl:element>
  459. </xsl:template>
  460.  
  461.  
  462. <xsl:template match="text:p[@text:style-name='Section2 Title']">
  463.     <xsl:element name="title">
  464.         <xsl:apply-templates/>
  465.     </xsl:element >
  466. </xsl:template>
  467.  
  468.  
  469. <xsl:template match="text:p[@text:style-name='Section3 Title']">
  470.     <xsl:element name="title">
  471.         <xsl:apply-templates/>
  472.     </xsl:element>
  473. </xsl:template>
  474.  
  475. <xsl:template match="text:footnote-citation">
  476. </xsl:template>
  477.  
  478. <xsl:template match="text:p[@text:style-name='Mediaobject']">
  479.     <mediaobject>
  480.         <xsl:apply-templates/>
  481.     </mediaobject>
  482. </xsl:template>
  483.  
  484. <xsl:template match="office:annotation/text:p">
  485.     <note>
  486.     <remark>
  487.         <xsl:apply-templates/>
  488.     </remark>
  489.     </note>
  490. </xsl:template>
  491.  
  492. <!--<xsl:template match="meta:initial-creator">
  493.     <author>
  494.     <xsl:apply-templates />
  495.         </author>
  496. </xsl:template>-->
  497.  
  498. <xsl:template match="table:table"> 
  499.     <xsl:choose>
  500.         <xsl:when test="following-sibling::text:p[@text:style-name='Table']">
  501.             <table frame="all">
  502.                  <xsl:attribute name="id">
  503.                     <xsl:value-of select="@table:name"/>
  504.                 </xsl:attribute>
  505.                 <title>
  506.                     <xsl:value-of select="following-sibling::text:p[@text:style-name='Table']"/>
  507.                 </title>
  508.                 <xsl:call-template name="generictable"/>
  509.             </table>
  510.         </xsl:when>
  511.         <xsl:otherwise>
  512.             <informaltable frame="all">
  513.                 <xsl:call-template name="generictable"/>
  514.             </informaltable>
  515.         </xsl:otherwise>
  516.     </xsl:choose>
  517. </xsl:template>
  518.  
  519.  
  520. <xsl:template name="generictable">
  521.             <xsl:variable name="cells" select="count(descendant::table:table-cell)" ></xsl:variable>
  522.             <xsl:variable name="rows"><xsl:value-of select="count(descendant::table:table-row) "/></xsl:variable>
  523.             <xsl:variable name="cols"><xsl:value-of select="$cells div $rows"/></xsl:variable>
  524.             <xsl:variable name="numcols">
  525.             <xsl:choose>
  526.                     <xsl:when test="child::table:table-column/@table:number-columns-repeated">
  527.                             <xsl:value-of select="number(table:table-column/@table:number-columns-repeated+1)"/>
  528.                     </xsl:when>
  529.                     <xsl:otherwise >
  530.                             <xsl:value-of select="$cols"/>
  531.                     </xsl:otherwise>
  532.             </xsl:choose>
  533.         </xsl:variable>
  534.         <xsl:element name="tgroup">
  535.             <xsl:attribute name="cols">
  536.                         <xsl:value-of select="$numcols"/>
  537.             </xsl:attribute>    
  538.             <xsl:call-template name="colspec"><xsl:with-param name="left" select="1" /></xsl:call-template>
  539.                 <xsl:apply-templates/>
  540.         </xsl:element>
  541. </xsl:template>
  542.  
  543.  
  544.  
  545. <xsl:template name="colspec">
  546.     <xsl:param name="left"/>
  547.     <xsl:if test="number($left < ( table:table-column/@table:number-columns-repeated +2)  )">
  548.             <xsl:element name="colspec">
  549.                 <xsl:attribute name="colnum"><xsl:value-of select="$left"/></xsl:attribute>
  550.                 <xsl:attribute name="colname">c<xsl:value-of select="$left"/></xsl:attribute>
  551.             </xsl:element>
  552.             <xsl:call-template name="colspec"><xsl:with-param name="left" select="$left+1" /></xsl:call-template>
  553.     </xsl:if>
  554. </xsl:template>
  555.  
  556.  
  557.  
  558. <xsl:template match="table:table-column">
  559.         <xsl:apply-templates/>
  560. </xsl:template>
  561.  
  562. <xsl:template match="table:table-header-rows">
  563.     <thead>
  564.         <xsl:apply-templates/>
  565.     </thead>    
  566. </xsl:template>
  567.  
  568. <xsl:template match="table:table-header-rows/table:table-row">
  569.     <row>
  570.         <xsl:apply-templates />
  571.     </row>
  572. </xsl:template>
  573.  
  574. <xsl:template match="table:table/table:table-row">
  575.     <xsl:if test="not(preceding-sibling::table:table-row)">
  576.         <xsl:text disable-output-escaping="yes"><tbody></xsl:text>
  577.     </xsl:if>
  578.     <row>
  579.         <xsl:apply-templates />
  580.     </row>
  581.         <xsl:if test="not(following-sibling::table:table-row)">
  582.         <xsl:text disable-output-escaping="yes"></tbody></xsl:text>
  583.     </xsl:if>
  584. </xsl:template>
  585.  
  586. <xsl:template match="table:table-cell">
  587.  <xsl:element name="entry">
  588.          <xsl:if test="@table:number-columns-spanned >'1'">
  589.             <xsl:attribute name="namest"><xsl:value-of select="concat('c',count(preceding-sibling::table:table-cell[not(@table:number-columns-spanned)]) +sum(preceding-sibling::table:table-cell/@table:number-columns-spanned)+1)"/></xsl:attribute>
  590.             <xsl:attribute name="nameend"><xsl:value-of select="concat('c',count(preceding-sibling::table:table-cell[not(@table:number-columns-spanned)]) +sum(preceding-sibling::table:table-cell/@table:number-columns-spanned)+ @table:number-columns-spanned)"/></xsl:attribute>
  591.         </xsl:if>
  592.         <xsl:apply-templates />
  593.     </xsl:element>
  594. </xsl:template>
  595.  
  596. <xsl:template match="text:p">
  597. <xsl:choose>
  598.     <xsl:when test="@text:style-name='Table'">
  599.     </xsl:when>
  600.     <xsl:otherwise>
  601.         <para>        
  602.             <xsl:apply-templates/>
  603.         </para>
  604.     </xsl:otherwise>
  605. </xsl:choose>
  606. </xsl:template>
  607.  
  608. <xsl:template match="text:unordered-list">
  609. <xsl:choose>
  610.     <xsl:when  test="@text:style-name='Var List'">
  611.         <variablelist>
  612.             <xsl:apply-templates/>
  613.         </variablelist>
  614.     </xsl:when>
  615.     <xsl:when  test="@text:style-name='UnOrdered List'">
  616.         <variablelist>
  617.             <xsl:apply-templates/>
  618.         </variablelist>
  619.     </xsl:when>
  620.     <xsl:otherwise>
  621.     <itemizedlist>
  622.         <title></title>
  623.         <xsl:apply-templates/>
  624.     </itemizedlist>
  625.     </xsl:otherwise>
  626. </xsl:choose>
  627. </xsl:template>
  628.  
  629. <xsl:template match="text:list-item">
  630. <!--    <xsl:if test="parent::text:unordered-list/@text:style-name='Var List'">
  631.         
  632.     </xsl:if>
  633.     <xsl:if test="not(parent::text:unordered-list/@text:style-name='Var List')">
  634.         <listitem>
  635.             <xsl:apply-templates/>
  636.         </listitem>
  637.     </xsl:if>-->
  638.     <xsl:choose>
  639.         <xsl:when test="parent::text:unordered-list/@text:style-name='Var List' ">
  640.             <xsl:if test="child::text:p[@text:style-name='VarList Term']">
  641.             <xsl:element name="varlistentry">
  642.                     <xsl:apply-templates select="child::text:p[@text:style-name='VarList Term']"/>
  643.                         <xsl:if test="following-sibling::text:list-item[1]/text:p[@text:style-name='VarList Item']">
  644.                             <xsl:apply-templates select="following-sibling::text:list-item[1]/text:p"/>
  645.                         </xsl:if>
  646.                   </xsl:element>
  647.             </xsl:if>
  648.         </xsl:when>
  649.         <xsl:otherwise>
  650.             <xsl:element name="listitem">
  651.                 <xsl:apply-templates/>
  652.             </xsl:element>
  653.         </xsl:otherwise>
  654.     </xsl:choose>    
  655. </xsl:template>
  656.  
  657.  
  658.  
  659.  
  660.  
  661. <xsl:template match="dc:title">
  662. </xsl:template>
  663.  
  664. <xsl:template match="dc:description">
  665.     <abstract><para>
  666.         <xsl:apply-templates/>
  667.         </para>
  668.     </abstract>
  669. </xsl:template>
  670.  
  671. <xsl:template match="dc:subject">
  672. </xsl:template>
  673.  
  674.  
  675. <xsl:template match="meta:generator">
  676. </xsl:template>
  677.  
  678. <xsl:template match="draw:plugin">
  679. <xsl:element name="audioobject">
  680.     <xsl:attribute name="fileref">
  681.         <xsl:value-of select="@xlink:href"/>
  682.     </xsl:attribute>
  683.     <xsl:attribute name="width">
  684.     </xsl:attribute>
  685. </xsl:element>
  686. </xsl:template>
  687.  
  688. <xsl:template match="text:footnote">
  689.     <footnote>
  690.         <xsl:apply-templates/>
  691.     </footnote>
  692. </xsl:template>
  693.  
  694. <xsl:template match="text:footnote-body">
  695.         <xsl:apply-templates/>
  696. </xsl:template>
  697.  
  698.  
  699. <xsl:template match="draw:text-box">
  700. </xsl:template>
  701.  
  702.  
  703.  
  704. <xsl:template match="draw:image">
  705. <xsl:choose>
  706.     <xsl:when test="parent::text:p[@text:style-name='Mediaobject']">
  707.         <xsl:element name="imageobject">
  708.             <xsl:element name="imagedata">
  709.             <xsl:attribute name="fileref">
  710.                 <xsl:value-of select="@xlink:href"/>
  711.             </xsl:attribute>
  712.             </xsl:element>
  713.             <xsl:element name="caption">
  714.                 <xsl:value-of select="."/>
  715.             </xsl:element>
  716.         </xsl:element>
  717.     </xsl:when>
  718.     <xsl:otherwise>
  719.         <xsl:element name="inlinegraphic">
  720.             <xsl:attribute name="fileref">
  721.                 <xsl:value-of select="@xlink:href"/>
  722.             </xsl:attribute>
  723.             <xsl:attribute name="width"></xsl:attribute>
  724.         </xsl:element>
  725.     </xsl:otherwise>
  726. </xsl:choose>
  727. </xsl:template>
  728.  
  729.  
  730.  
  731.  
  732.  
  733. <xsl:template match="text:span">
  734. <xsl:choose>
  735. <xsl:when test="./@text:style-name='GuiMenu'">
  736.         <xsl:element name="guimenu">
  737.             <xsl:value-of select="."/>    
  738.         </xsl:element>
  739.     </xsl:when>
  740.     <xsl:when test="./@text:style-name='GuiSubMenu'">
  741.         <xsl:element name="guisubmenu">
  742.             <xsl:value-of select="."/>    
  743.         </xsl:element>
  744.     </xsl:when>
  745.         <xsl:when test="@text:style-name='GuiMenuItem'">
  746.         <xsl:element name="guimenuitem">
  747.             <xsl:value-of select="."/>    
  748.         </xsl:element>
  749.     </xsl:when>
  750.     <xsl:when test="@text:style-name='GuiButton'">
  751.         <xsl:element name="guibutton">
  752.             <xsl:value-of select="."/>    
  753.         </xsl:element>
  754.     </xsl:when>
  755.         <xsl:when test="@text:style-name='GuiButton'">
  756.         <xsl:element name="guibutton">
  757.             <xsl:value-of select="."/>    
  758.         </xsl:element>
  759.     </xsl:when>
  760.     <xsl:when test="@text:style-name='GuiLabel'">
  761.         <xsl:element name="guilabel">
  762.             <xsl:value-of select="."/>    
  763.         </xsl:element>
  764.     </xsl:when>
  765.     <xsl:when test="@text:style-name='Emphasis'">
  766.         <xsl:element name="emphasis">
  767.             <xsl:value-of select="."/>    
  768.         </xsl:element>
  769.     </xsl:when>
  770.     <xsl:when test="@text:style-name='FileName'">
  771.         <xsl:element name="filename">
  772.             <xsl:value-of select="."/>    
  773.         </xsl:element>
  774.     </xsl:when>
  775.     <xsl:when test="@text:style-name='Application'">
  776.         <xsl:element name="application">
  777.             <xsl:value-of select="."/>    
  778.         </xsl:element>
  779.     </xsl:when>
  780.     <xsl:when test="@text:style-name='Command'">
  781.         <command>
  782.             <xsl:apply-templates/>
  783.         </command>
  784.     </xsl:when>
  785.     <xsl:when test="@text:style-name='SubScript'">
  786.         <subscript>
  787.             <xsl:apply-templates/>
  788.         </subscript>
  789.     </xsl:when>
  790.     <xsl:when test="@text:style-name='SuperScript'">
  791.         <superscript>
  792.             <xsl:apply-templates/>
  793.         </superscript>
  794.     </xsl:when>
  795.     <xsl:when test="@text:style-name='SystemItem'">
  796.         <systemitem>
  797.             <xsl:apply-templates/>
  798.         </systemitem>
  799.     </xsl:when>
  800.     <xsl:when test="@text:style-name='ComputerOutput'">
  801.         <computeroutput>
  802.             <xsl:apply-templates/>
  803.         </computeroutput>
  804.     </xsl:when>
  805.     <xsl:when test="@text:style-name='Highlight'">
  806.         <highlight>
  807.             <xsl:apply-templates/>
  808.         </highlight>
  809.     </xsl:when>
  810.         <xsl:when test="@text:style-name='KeyCap'">
  811.         <keycap>
  812.             <xsl:apply-templates/>
  813.         </keycap>
  814.     </xsl:when>
  815.     <xsl:when test="@text:style-name='KeySym'">
  816.         <xsl:element name="keysym">
  817.             <xsl:apply-templates/>
  818.         </xsl:element>
  819.     </xsl:when>
  820.     <xsl:when test="@text:style-name='KeyCombo'">
  821.         <keycombo>
  822.             <xsl:apply-templates/>
  823.         </keycombo>
  824.     </xsl:when>
  825.     <xsl:otherwise>
  826.         <xsl:apply-templates/>
  827.     </xsl:otherwise>
  828. </xsl:choose>
  829.     
  830. </xsl:template>
  831.  
  832.  
  833. <xsl:template match="text:a">
  834.     <xsl:choose>
  835.         <xsl:when test="contains(@xlink:href,'://')">
  836.             <xsl:element name="ulink">
  837.                 <xsl:attribute name="url">
  838.                     <xsl:value-of select="@xlink:href"/>
  839.                 </xsl:attribute>
  840.                 <xsl:apply-templates/>
  841.             </xsl:element>
  842.         </xsl:when>
  843.         <xsl:when test="not(contains(@xlink:href,'#'))">
  844.             <xsl:element name="olink">
  845.                 <xsl:attribute name="targetdocent">
  846.                     <xsl:value-of select="@xlink:href"/>
  847.                 </xsl:attribute>
  848.                 <xsl:apply-templates/>
  849.             </xsl:element>
  850.         </xsl:when>
  851.         <xsl:otherwise>
  852.         <xsl:variable name="linkvar" select="substring-after(@xlink:href,'#')"/>
  853.             <xsl:element name="link">
  854.                 <xsl:attribute name="linkend">
  855.                     <xsl:value-of select="substring-before($linkvar,'%')"/>    
  856.                 </xsl:attribute>
  857.                 <xsl:apply-templates/>
  858.             </xsl:element>
  859.         </xsl:otherwise>
  860.     </xsl:choose>
  861. </xsl:template>
  862.  
  863.  
  864. </xsl:stylesheet>